﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class ValueType : System.Web.UI.Page
{
    //结构体
    struct Book
    {
        public int page;
        public double price;
    }

    //枚举
    enum FontType
    {
        Normal = 10,
        Bold,
        Itaic
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.Write("值类型的演示<br>");
        //整型
        int a = 10;
        long b = 10L;
        short c = 10;
        Response.Write(a.GetType() + "<br>");
        Response.Write(b.GetType() + "<br>");
        Response.Write(c.GetType() + "<br>");

        //实数
        float d = 1.0f;
        double E = 1.0;
        decimal f = 1.0M;

        Response.Write(d.GetType() + "<br>");
        Response.Write(e.GetType() + "<br>");
        Response.Write(f.GetType() + "<br>");

        //字符
        char g = 'a';
        char h = '中';

        Response.Write(g.GetType() + "<br>");
        Response.Write(h.GetType() + "<br>");
        //布尔
        bool i = true;
        Response.Write(i.GetType() + "<br>");

        //结构体
        Book book = new Book() { page = 20, price = 40.0 };
        Response.Write(string.Format("页数{0},价格{1}<br>", book.page, book.price));

        //枚举
        FontType ft = FontType.Normal;
        Response.Write(ft + "<br>");
        ft++;
        Response.Write(ft + "<br>");
    }
}